home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / gridex / frmlist.frm < prev    next >
Text File  |  1998-01-02  |  7KB  |  247 lines

  1. VERSION 5.00
  2. Object = "{BA7155BB-813E-11D1-B8F4-0080ADA85B53}#1.0#0"; "JSGridEX.ocx"
  3. Begin VB.Form frmList 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Form1"
  6.    ClientHeight    =   3075
  7.    ClientLeft      =   1365
  8.    ClientTop       =   2865
  9.    ClientWidth     =   6660
  10.    Icon            =   "frmList.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   205
  15.    ScaleMode       =   3  'Pixel
  16.    ScaleWidth      =   444
  17.    ShowInTaskbar   =   0   'False
  18.    StartUpPosition =   2  'CenterScreen
  19.    Begin VB.CommandButton cmdCancel 
  20.       Cancel          =   -1  'True
  21.       Caption         =   "Cancel"
  22.       BeginProperty Font 
  23.          Name            =   "Tahoma"
  24.          Size            =   8.25
  25.          Charset         =   0
  26.          Weight          =   400
  27.          Underline       =   0   'False
  28.          Italic          =   0   'False
  29.          Strikethrough   =   0   'False
  30.       EndProperty
  31.       Height          =   330
  32.       Left            =   5415
  33.       TabIndex        =   2
  34.       Top             =   735
  35.       Width           =   1200
  36.    End
  37.    Begin VB.CommandButton cmdOK 
  38.       Caption         =   "OK"
  39.       Default         =   -1  'True
  40.       BeginProperty Font 
  41.          Name            =   "Tahoma"
  42.          Size            =   8.25
  43.          Charset         =   0
  44.          Weight          =   400
  45.          Underline       =   0   'False
  46.          Italic          =   0   'False
  47.          Strikethrough   =   0   'False
  48.       EndProperty
  49.       Height          =   330
  50.       Left            =   5415
  51.       TabIndex        =   1
  52.       Top             =   360
  53.       Width           =   1200
  54.    End
  55.    Begin JSGridEX.GridEX gexList 
  56.       Height          =   2550
  57.       Left            =   75
  58.       TabIndex        =   0
  59.       Top             =   390
  60.       Width           =   5220
  61.       _ExtentX        =   9208
  62.       _ExtentY        =   4498
  63.       MethodHoldFields=   -1  'True
  64.       ContScroll      =   -1  'True
  65.       GroupByBoxInfoText=   ""
  66.       AllowEdit       =   0   'False
  67.       GroupByBoxVisible=   0   'False
  68.       BackColor       =   -2147483624
  69.       ForeColor       =   -2147483625
  70.       ImageCount      =   3
  71.       ImagePicture1   =   "frmList.frx":000C
  72.       ImagePicture2   =   "frmList.frx":011E
  73.       ImagePicture3   =   "frmList.frx":0438
  74.       ColumnCount     =   3
  75.       CardCaption1    =   -1  'True
  76.       ColHeaderIcon1  =   1
  77.       ColKey1         =   "Icon"
  78.       ColWidth1       =   330
  79.       ColumnType1     =   1
  80.       ColEditType1    =   0
  81.       ColKey2         =   "ID"
  82.       ColWidth2       =   1200
  83.       ColEditType2    =   0
  84.       ColKey3         =   "Name"
  85.       ColWidth3       =   3390
  86.       ColEditType3    =   0
  87.       GridLines       =   0   'False
  88.       BackColorBkg    =   -2147483624
  89.       ColumnHeaderHeight=   285
  90.    End
  91.    Begin VB.Label lblInfo 
  92.       AutoSize        =   -1  'True
  93.       BeginProperty Font 
  94.          Name            =   "Tahoma"
  95.          Size            =   8.25
  96.          Charset         =   0
  97.          Weight          =   400
  98.          Underline       =   0   'False
  99.          Italic          =   0   'False
  100.          Strikethrough   =   0   'False
  101.       EndProperty
  102.       Height          =   195
  103.       Left            =   90
  104.       TabIndex        =   3
  105.       Top             =   90
  106.       Width           =   45
  107.    End
  108. End
  109. Attribute VB_Name = "frmList"
  110. Attribute VB_GlobalNameSpace = False
  111. Attribute VB_Creatable = False
  112. Attribute VB_PredeclaredId = True
  113. Attribute VB_Exposed = False
  114. Option Explicit
  115.  
  116. Dim m_OK As Boolean
  117. Public Function ChooseSupplier(ByVal dbName As String, ByVal SupplierID As String) As Variant
  118. Dim cols As JSGridEX.Columns
  119. Dim col As JSGridEX.Column
  120. Dim rsTemp As Recordset
  121.  
  122.     m_OK = False
  123.     Set cols = gexList.Columns
  124.     Set col = cols("Icon")
  125.     col.DefaultIcon = 3
  126.     Set col = cols("ID")
  127.     col.Caption = "Supplier ID"
  128.     col.DataField = "SupplierID"
  129.     col.TextAlignment = jgexAlignRight
  130.     col.SortType = jgexSortTypeNumeric
  131.     Set col = cols("Name")
  132.     col.Caption = "Supplier"
  133.     col.DataField = "CompanyName"
  134.     gexList.DatabaseName = dbName
  135.     gexList.RecordSource = "Suppliers"
  136.     gexList.RecordsetType = jgexRSDAOTable
  137.     gexList.HoldFields
  138.     gexList.Rebind
  139.     gexList.SortKeys.Add 3, jgexSortAscending
  140.     Set Me.Icon = gexList.GridImages(3).Picture
  141.     Me.Caption = "Suppliers List"
  142.     lblInfo = "Select a supplier from the list:"
  143.     gexList.RefreshSort
  144.     Set rsTemp = gexList.Recordset
  145.     rsTemp.Index = "PrimaryKey"
  146.     rsTemp.Seek "=", SupplierID
  147.     If rsTemp.NoMatch Then
  148.         gexList.Row = 0
  149.     Else
  150.         gexList.MoveToBookmark rsTemp.Bookmark
  151.     End If
  152.     Show 1
  153.     If m_OK Then
  154.         If gexList.Row <> 0 Then
  155.             ChooseSupplier = gexList.Value(2)
  156.         Else
  157.             ChooseSupplier = ""
  158.         End If
  159.     Else
  160.         ChooseSupplier = Null
  161.     End If
  162.     Unload Me
  163. End Function
  164.  
  165. Public Function ChooseCustomer(ByVal dbName As String, ByVal CustomerID As String) As Variant
  166. Dim cols As JSGridEX.Columns
  167. Dim col As JSGridEX.Column
  168. Dim rsTemp As Recordset
  169.  
  170.     m_OK = False
  171.     Set cols = gexList.Columns
  172.     Set col = cols("Icon")
  173.     col.DefaultIcon = 3
  174.     Set col = cols("ID")
  175.     col.Caption = "Customer ID"
  176.     col.DataField = "CustomerID"
  177.     Set col = cols("Name")
  178.     col.Caption = "Customer"
  179.     col.DataField = "CompanyName"
  180.     gexList.DatabaseName = dbName
  181.     gexList.RecordSource = "Customers"
  182.     gexList.RecordsetType = jgexRSDAOTable
  183.     gexList.HoldFields
  184.     gexList.Rebind
  185.     gexList.SortKeys.Add 3, jgexSortAscending
  186.     Set Me.Icon = gexList.GridImages(2).Picture
  187.     Me.Caption = "Customer List"
  188.     lblInfo = "Select a customer from the list:"
  189.     gexList.RefreshSort
  190.     Set rsTemp = gexList.Recordset
  191.     rsTemp.Index = "PrimaryKey"
  192.     rsTemp.Seek "=", CustomerID
  193.     If rsTemp.NoMatch Then
  194.         gexList.Row = 0
  195.     Else
  196.         gexList.MoveToBookmark rsTemp.Bookmark
  197.     End If
  198.     Show 1
  199.     If m_OK Then
  200.         If gexList.Row <> 0 Then
  201.             ChooseCustomer = gexList.Value(2)
  202.         Else
  203.             ChooseCustomer = ""
  204.         End If
  205.     Else
  206.         ChooseCustomer = Null
  207.     End If
  208.     Unload Me
  209. End Function
  210.  
  211.  
  212. Private Sub cmdCancel_Click()
  213.  
  214.     Hide
  215.     
  216. End Sub
  217.  
  218. Private Sub cmdOK_Click()
  219.  
  220.     m_OK = True
  221.     Hide
  222. End Sub
  223.  
  224.  
  225. Private Sub gexList_ColumnHeaderClick(Column As JSGridEX.Column)
  226.  
  227.     If Column.Index <> 1 Then
  228.         If Column.SortOrder = jgexSortNone Then
  229.             gexList.SortKeys.Clear
  230.             gexList.SortKeys.Add Column.Index, jgexSortAscending
  231.         Else
  232.             If gexList.SortKeys(1).SortOrder = jgexSortAscending Then
  233.                 gexList.SortKeys(1).SortOrder = jgexSortDescending
  234.             Else
  235.                 gexList.SortKeys(1).SortOrder = jgexSortAscending
  236.             End If
  237.         End If
  238.     End If
  239. End Sub
  240.  
  241. Private Sub gexList_DblClick()
  242.  
  243.     cmdOK_Click
  244.     
  245. End Sub
  246.  
  247.